-
Couldn't load subscription status.
- Fork 20
Allow create PVPool instances in locations without PV #1215
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enables the creation of PVPool instances even in locations without any PV installations.
- Conditionally initializes the bounds_tracker attribute based on the presence of component_ids
- Adds a check in the stop method to safely await the stop of bounds_tracker only when it has been instantiated
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/frequenz/sdk/timeseries/pv_pool/_pv_pool_reference_store.py | Conditionally initialize and stop the bounds_tracker based on component_ids |
| RELEASE_NOTES.md | Added note regarding creation of PV Pool instances without PV |
| self.bounds_channel.new_sender(), | ||
| ) | ||
| self.bounds_tracker.start() | ||
|
|
Copilot
AI
May 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Consider adding an inline comment to explain why bounds_tracker is initialized to None and conditionally set based on component_ids. This will help maintainers understand the intent behind this change.
| # Initialize bounds_tracker to None. It will be conditionally assigned | |
| # if component_ids are provided or derived, as it is only needed to track | |
| # system bounds for the specified components. |
Without this, it was hard to create `PVPool`s at locations without PV. Signed-off-by: Sahas Subramanian <[email protected]>
Signed-off-by: Sahas Subramanian <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approving as this, if it is really an issue, it is not introduced by this PR.
| if self.bounds_tracker is not None: | ||
| await self.bounds_tracker.stop() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not introduced by this PR, but just FYI, as I mentioned in other insteances and at least if this is a BackgroundService, stopping of sub-services should be done separately via cancel() and wait(), and leave stop() being just an alias for self.cancel(); await self.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not a bug the way it is now, at least not in this layer, because this is in the *reference_store, which is supposed to be shared already.
But we will have to look at the outer layers, where we just removed the call to *reference_store.stop() as a temporary fix.
Closes #1130